home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PROGRAMR / FOYEH201.ZIP / FOYEH1.INT < prev    next >
Text File  |  1993-10-04  |  23KB  |  727 lines

  1. {*** TURBO PASCAL UNIT: INTERFACE TO FOYEH1.DLL                 **}
  2. {*** Released into the public domain by Dr. A. Olowofoyeku      **}
  3.  
  4. {*** If anyone can convert this into a C/C++ HEADER file        **}
  5. {*** please do so, and please send me a copy of the header      **}
  6. {*** file.                                                      **}
  7.  
  8. {*** The Dynamic Link Library FOYEH1.DLL is supplied with       **}
  9. {*** many of my Windows and Win-OS/2 programs. I am constantly  **}
  10. {*** developing and updating it. If you have any problems or    **}
  11. {*** discover any bugs while using it with your own programs    **}
  12. {*** please mail me, and I will try and fix it. NOTE however    **}
  13. {*** that I do not make any warranties concerning FOYEH1.DLL    **}
  14. {*** or this interface UNIT to it. Everybody uses both of them  **}
  15. {*** at their own risk. The DLL itself is already widely        **}
  16. {*** available. I am only releasing the interface to it, so     **}
  17. {*** that others may benefit from some of its routines.         **}
  18.  
  19. {*** NOTE: that some of the routines in the DLL require the     **}
  20. {*** presence of Borland's BWCC.DLL. If you are a TPW/BP7 user  **}
  21. {*** you already have this DLL. However, most of the routines   **}
  22. {*** do not require BWCC.DLL. You can normally tell from the    **}
  23. {*** name of the routine whether it uses any call from BWCC.DLL **}
  24.  
  25.  
  26. {*** Note also, that if you have an old version of FOYEH1.DLL   **}
  27. {*** then some of the routines may not be available.            **}
  28.  
  29.  
  30. {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  31. { Dr. A. Olowofoyeku                                  }
  32. { 268 Horwood                                         }
  33. { Newcastle                                           }
  34. { Staffs ST5 5BQ,                                     }
  35. { England.                                            }
  36. {                                                     }
  37. {  E-mail:laa12@seq1.keele.ac.uk                      }
  38. {                                                     }
  39. { October 1993.                                       }
  40. {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  41.  
  42.  
  43. {-----------------------------------------------------------------------}
  44. THIS FILE PROVIDES A DESCRIPTION OF THE ROUTINES IN THE INTERFACE
  45. SECTION OF THE UNIT "FOYEH1.PAS", A TURBO/BORLAND PASCAL TO MY
  46. DYNAMIC LINK LIBRARY, "FOYEH1.DLL".
  47.  
  48. ALL THE FOUR FILES (i.e., FOYEH1.DLL, FOYEH1.PAS, FOYEH1.INT, AND
  49. FOYEH1.SUM) MUST BE INCLUDED IN ANY DISTRIBUTION.
  50. {-----------------------------------------------------------------------}
  51.  
  52.  
  53. FOYEH1.DLL was compiled with the following compiler directives;
  54.      {$S-,R-,V-,I-,B-,F+,G+}
  55.  
  56. USES
  57. Wintypes;
  58.  
  59. {** new data types used in the DLL  ***}
  60.    Type
  61.      String79 = String[79];
  62.      StringArray = Array[1..20] of String79;
  63.  
  64.  
  65. {** Routines in the DLL ***}
  66.  
  67. {-----------------------------------------------------------------------}
  68. Function   DllVersion : Word;
  69. {** Returns the version number of the current copy of FOYEH1.DLL **}
  70.  
  71. {-----------------------------------------------------------------------}
  72. Function   GetS(Prompt : String) : String;
  73. {**
  74.     Get a string from the keyboard. PROMPT is a string that prompts
  75.     the user for input. This function uses the ReadKey() function from
  76.     the WINCRT unit, and allows you to exit by pressing ESCape
  77.     e.g. MyName := GetS('Type in your name : ');
  78.  
  79.     Note: do not use this function in an OWL program. It is only
  80.     useful for programs using the WINCRT unit's simulated windows.
  81.  **}
  82.  
  83. {-----------------------------------------------------------------------}
  84. Function   ShowDir : String79;
  85. {** Returns the current directory **}
  86.  
  87.     e.g.
  88.        CurrentDir := ShowDir;
  89.  
  90. {-----------------------------------------------------------------------}
  91. Procedure  ErrorMessage(Caption, Msg : PChar);
  92. {**
  93.     This is a shell to the MessageBox API call. It allows you to just
  94.     type in your message and its caption. The dialog box produced has
  95.     an OK button only.
  96.  
  97.     e.g.
  98.         ErrorMessage('ERROR','File not found!');
  99. **}
  100.  
  101. {-----------------------------------------------------------------------}
  102. Procedure  BWCCErrorMessage(Caption, Msg : PChar; Extra : Word);
  103. {**
  104.     Same as ErrorMessage (above) but differs in two respects. It calls
  105.     the MessageBox in BWCC.DLL instead of the one in the Windows API,
  106.     and it allows you to specify, in "EXTRA", other messagebox attributes.
  107.  
  108.     e.g. BWCCErrorMessage('ERROR','File not found!', 0);
  109.          BWCCErrorMessage('ERROR','File not found!', mb_IconExclamation);
  110.  
  111. **}
  112. {-----------------------------------------------------------------------}
  113.  
  114. Procedure  ModalMessageBox(Caption, Msg : PChar);
  115. {**
  116.     Produces a modal message box. The user cannot do anything else until
  117.     the messagebox is removed (by clicking on the OK button, or by
  118.     pressing <ENTER>
  119. **}
  120. {-----------------------------------------------------------------------}
  121.  
  122. Function   Confirm(Caption, Msg : PChar) : Boolean;
  123. {**
  124.     Allows you to answer "YES" or "NO" to the message in "MSG". If
  125.     you click on the YES button, the function returns TRUE, else it
  126.     returns FALSE.
  127.  
  128.     e.g. If Confirm('Exit!','Sure you want to Exit?') then QUIT;
  129.  
  130. **}
  131.  
  132. {-----------------------------------------------------------------------}
  133.  
  134. Function   BwccConfirm(Caption, Msg : PChar) : Boolean;
  135. {**
  136.     Same as CONFIRM() above, but uses the BWCC.DLL message box.
  137. **}
  138.  
  139. {---------------------------------------------------------------------}
  140.  
  141. Function   ConfirmModal(Caption,Msg : PChar) : Boolean;
  142. {**
  143.    Same as CONFIRM() above, but uses a modal Windows message box.
  144. **}
  145.  
  146. {-----------------------------------------------------------------------}
  147.  
  148. Function   ExistOnPath(FName : String79; Var Dest : String79) : Boolean;
  149. {**
  150.     Does a file exist in the DOS path? Returns TRUE if the file FNAME
  151.     is found in a directory which is in the DOS path. In this case, the
  152.     full pathname of the file is returned in DEST.
  153.  
  154.     e.g. If NOT ExistOnPath('WRITE.EXE', MyExec) then
  155.          ErrorMessage('ERROR','I cannot find WRITE.EXE');
  156. **}
  157.  
  158. {-----------------------------------------------------------------------}
  159.  
  160. Function   Exist(Var Fname : String79) : Boolean;
  161. {**
  162.     Does FNAME exist  in the CURRENT directory? If so, returns TRUE,
  163.     and returns the full pathname of the file.
  164.  
  165.     e.g.
  166.  
  167.     If Not Exist('MYPROG.HLP') then
  168.     ErrorMessage('ERROR','MYPROG.HLP is required in this directory!');
  169. **}
  170.  
  171. {-----------------------------------------------------------------------}
  172.  
  173. Function   FSize(FName : String79) : LongInt;
  174. {**
  175.     Returns the size (in bytes) of the FNAME. If the file does not
  176.     exist, returns ZERO.
  177.  
  178.     e.g.
  179.  
  180.     Var
  181.       Size : Longint;
  182.  
  183.       begin
  184.           Size := FSize('TPW.HLP');
  185.       end;
  186. **}
  187.  
  188. {-----------------------------------------------------------------------}
  189.  
  190. Function   HasWildCards(s : String) : Boolean;
  191. {**
  192.     Does the string "S" have wildcard characters? Wildcard characters
  193.     here are "*", and "?"
  194. **}
  195.  
  196. {-----------------------------------------------------------------------}
  197.  
  198. Function   IsDirectory(var MyDir : string79): Boolean;
  199. {**
  200.     Is MYDIR a valid sub-directory? If so, returns TRUE, and returns the
  201.     full pathname in MYDIR.
  202.  
  203.     e.g.
  204.      Var
  205.  
  206.       MyDir : String79;
  207.  
  208.       begin
  209.          MyDir := 'Z:\TPW\PROGRAMS';
  210.  
  211.          If Not IsDirectory(MyDir)
  212.          then writeln('You have specified an invalid directory!');
  213.       end;
  214. **}
  215.  
  216. {-----------------------------------------------------------------------}
  217.  
  218. Function   IsCommand(Command : String79) : String79;
  219. {**
  220.     Is "COMMAND" a valid executable file? Is so, returns the full
  221.     path name of the file. Valid executables for this purpose are
  222.     those with the extension COM, EXE, BAT, and PIF.
  223.  
  224.     If COMMAND does not have any extension, the function will append
  225.     each of the the above extensions to it, and try to locate a file
  226.     of that name in the DOS path. If no file is not found in the DOS
  227.     path, the funct